package zb.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zb.pojo.Order;
import zb.pojo.User;
import zb.service.Userservice;

import javax.annotation.Resource;

@RestController
public class Usercontroller {
    @Resource
    Userservice userservice;
    @RequestMapping("/getUserById/{id}")
    public User getUserById(@PathVariable("id") Integer id){
        return userservice.findUserById(id);
    }
    @RequestMapping("/useradd")
    public Integer save(@RequestBody Order order){
        return userservice.UserAddOrder(order);
    }
    @RequestMapping("/userdel/{id}")
    public Integer del(@PathVariable("id")Integer id){
        return userservice.UserDelOrder(id);
    }
    @RequestMapping("/userupdate")
    public Integer del(@RequestBody Order order){
        return userservice.UserUpdateOrder(order);
    }
}
